/*
 * AgentMonitor.java
 *
 * Created on August 23, 2007, 10:36 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.xeerkat.agent;

import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.infoset.xml.Document;
import org.xeerkat.restlet.xmpp.XMPPException;
import org.xeerkat.xmpp.ID;

/**
 *
 * @author alex
 */
public abstract class AgentMonitor
{

   public interface Listener {
      void onOnline(ID id);
      void onOffline(ID id);
   }
   
   protected Set<ID> known;
   protected List<Listener> listeners;
   protected List<Listener> selfListeners;
   
   /** Creates a new instance of AgentMonitor */
   public AgentMonitor()
   {
      known = new TreeSet<ID>();
      listeners = new ArrayList<Listener>();
      selfListeners = new ArrayList<Listener>();
   }
   
   public Set<ID> getAgents() {
      return known;
   }
   
   public List<Listener> getListeners() {
      return listeners;
   }
   
   public List<Listener> getSelfListeners() {
      return selfListeners;
   }
   
   abstract public boolean isConnected();
   
   abstract public void probePresence(ID to)
      throws XMPPException;
   
   abstract public void notifyManagement(ID to,String method,String username,String password,Document message)
      throws XMPPException;
   
}
